//
//  CPSQLTools.h
//  ChinaPoem
//
//  Created by 赵俊明 on 2019/3/4.
//  Copyright © 2019 赵俊明. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN
@class CPModel;
@interface CPSQLTools : NSObject
+ (instancetype)cp_sharedInstance;
- (NSMutableArray *)cp_query_poem:(NSString *)sql;
// 返回单个诗人数据
- (NSMutableArray *)cp_authorInfo:(NSString * __nullable)author;
// 查询诗人信息数据
- (NSMutableArray *)cp_all_authorInfo;
// 随机返回分享数据，返回数量自定
- (NSMutableArray *)cp_shareRandom:(NSInteger)count share:(BOOL)isShare;
// 获取分享数据，根据是否分享决定content内容是否进行处理
- (NSMutableArray *)cp_shareData:(NSString *)sql;
// 返回搜藏、历史所有数据
- (NSMutableArray *)cp_historyORSave:(NSString *)tabName;
// 查询数据表
- (CPModel *)cp_queryData:(NSString *)tableName ids:(NSString *)ids;
// 删除f搜查、历史数据
- (void)cp_delete:(CPModel *)model tName:(NSString *)tableName;
// 收藏、历史数据插入
- (void)cp_insert:(CPModel *)model tName:(NSString * __nullable)tableName save_sql:(NSString * __nullable)sql;
- (NSMutableArray *)cp_searchPoem:(NSString *)sql likeName:(NSString *)name column:(NSString *)column;
- (NSMutableArray *)cp_search:(NSString *)tName column:(NSString *)column;
- (BOOL)checkIsSave:(CPModel *)model;
// 获取诗人信息通过第一个字母
- (NSMutableArray *)cp_authorByAlpha:(NSString *)alpha;
@end

NS_ASSUME_NONNULL_END
